/**
 * @author Roderick Cusirramos Montesinos
 * @version 1.0
 */

package main;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

/**
 *
 * @author ROD
 */
public class SystemInfo {

    static SystemInfo instance = null;
    private Properties props ;
    private String language = "";

    public SystemInfo(){
        props = new Properties();
        
    }

    static public SystemInfo Instance() {
        if (instance == null) {
            instance = new SystemInfo();
            return instance;
        } else
            return instance;
    }

    public void finalize() {
        instance = null;
    }

    public void loadIntoProperties(){
        try {
            InputStream is =  new FileInputStream(this.language);
            if (is != null) {
                props.load(is);
            }else{
                System.out.println("No se encontro fichero");
            }
        }catch(Exception e){
            System.err.println(e.toString());
        }
    }

    public String getName(String key){
        return props.getProperty(key);
    }

    public void setLanguage(String language) {
        this.language = "config/"+language+".properties";
        loadIntoProperties();
    }

}

